package com.touni.designpattern.adapterpattern;

import com.touni.designpattern.adapterpattern.advancemedia.AdvanceMediaPlayer;
import com.touni.designpattern.adapterpattern.advancemedia.Mp4Player;
import com.touni.designpattern.adapterpattern.advancemedia.VclPlayer;

/**
 * @ClassName : MediaAdapter
 * @Description :
 * @Author : lwq
 * @Date: 2020-10-22 10:48
 */
public class MediaAdapter implements MediaPlayer {
    AdvanceMediaPlayer advanceMediaPlayer;

    public MediaAdapter(String fileType){
        if ("vcl".equals(fileType)){
            advanceMediaPlayer = new VclPlayer();
        }else if ("mp4".equals(fileType)){
            advanceMediaPlayer = new Mp4Player();
        }

    }

    @Override
    public void play(String fileType, String fileName) {
        if ("vcl".equals(fileType)){
            advanceMediaPlayer.playVcl(fileName);
        }else if ("mp4".equals(fileType)){
            advanceMediaPlayer.playMp4(fileName);
        }

    }
}
